package com.team.vlog_temp.Dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

@Repository
public class TestDao {
    private  JdbcTemplate jdbcTemplate;

    @Autowired
    public TestDao(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public List<Map<String, Object>> getAllRows() {
        return jdbcTemplate.queryForList("SELECT * FROM " + "persongroup1");
    }

    public List<Map<String,Object>> getZyxxInfo(){
        return jdbcTemplate.queryForList("SELECT * FROM " + "pubzyxx");
    }

    public List<Map<String, Object>> getZyxxInfoById(Long id) {
        return jdbcTemplate.queryForList("SELECT * FROM " + "pubzyxx"+" where zydm="+id +" and kjnd=2024 ");
    }
}
